GenerativeComponents Help

Animating an Expression

The first step in creating a simple animation is setting up your model so that is controlled by at least one node property. In the image below, the "WeaveComp" is a user-defined node that is controlled by two properties: height and width. The user-defined node has been arrayed across a surface. The surface and all underlying geometry have been hidden so that only the user-defined node and points controlling the host surface are visible.

In order to animate the node properties, you have to write a "for" loop in a script transaction. For more information on script transactions, refer to the GenerativeComponents interface section. Right-click the transaction before or after the to-be-created script transaction. Then in the pop-up menu click New Script Transaction, and select either Insert Before or Insert After. This opens a new window within which we write the following code:

transaction script 'animate height & width'
{
	int frames = 15;
	double widthStep = .075; 
	double heightStep = .75;

	for (int i = 1; i <= frames; i++)
	{ 
		width = width + widthStep;
		height = height + heightStep;
		UpdateGraph();
	} 
}

In the code above, each of the variables perform a similar task. Frames set how many frames to capture, while widthStep and heightStep are the increments that width and height (two Expression nodes defined earlier in the model) will increase at every iteration. A line of interest the UpdateGraph() function. This instructs GenerativeComponents to regenerate the open geometry windows at every iteration. For a more in-depth discussion of GCScript and built-in functions, refer to the GCScript Programming section.

The final frame of the animation is shown below.